package com.yuneec.fly.views;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;

import com.yuneec.fly.R;

/**
 * Created by gjw on 2016/11/30.
 */

public class TrimView extends RelativeLayout {
    private View topBtn;
    private View bottomBtn;
    private View leftBtn;
    private View rightBtn;

    public TrimView(Context context) {
        this(context, null);
    }

    public TrimView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public TrimView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    private void init(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.view_trim, this, true);
        topBtn = view.findViewById(R.id.topBtn);
        bottomBtn = view.findViewById(R.id.bottomBtn);
        leftBtn = view.findViewById(R.id.leftBtn);
        rightBtn = view.findViewById(R.id.rightBtn);
    }

    public void setTopClickListener(OnClickListener onClickListener) {
        topBtn.setOnClickListener(onClickListener);
    }

    public void setBottomClickListener(OnClickListener onClickListener) {
        bottomBtn.setOnClickListener(onClickListener);
    }

    public void setLeftClickListener(OnClickListener onClickListener) {
        leftBtn.setOnClickListener(onClickListener);
    }

    public void setRightClickListener(OnClickListener onClickListener) {
        rightBtn.setOnClickListener(onClickListener);
    }
}
